import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** CRM 备货单记录明细信息 */
export interface StockProductDetail {
          id: number; // 主键
          itemNo: string; // 客户道具编码
          no?: string; // 产品编码
          productName?: string; // 产品名称
          productId: number; // 产品id
          dimension: string; // 产品规格尺寸
          coefficient?: number; // 标配系数
          stockCount?: number; // 实际备货数量
          stockNum: number; // 当前库存数量
          tcustomerStockCount?: number; // 客户备货数量
          theoryStockCount?: number; // 理论备货数量
  }

// CRM 备货单记录明细 API
export const StockProductDetailApi = {
  // 查询CRM 备货单记录明细分页
  getStockProductDetailPage: async (params: any) => {
    return await request.get({ url: `/crm/stock-product-detail/page`, params })
  },

  // 查询CRM 备货单记录明细详情
  getStockProductDetail: async (id: number) => {
    return await request.get({ url: `/crm/stock-product-detail/get?id=` + id })
  },

  // 新增CRM 备货单记录明细
  createStockProductDetail: async (data: StockProductDetail) => {
    return await request.post({ url: `/crm/stock-product-detail/create`, data })
  },

  // 修改CRM 备货单记录明细
  updateStockProductDetail: async (data: StockProductDetail) => {
    return await request.put({ url: `/crm/stock-product-detail/update`, data })
  },

  // 删除CRM 备货单记录明细
  deleteStockProductDetail: async (id: number) => {
    return await request.delete({ url: `/crm/stock-product-detail/delete?id=` + id })
  },

  /** 批量删除CRM 备货单记录明细 */
  deleteStockProductDetailList: async (ids: number[]) => {
    return await request.delete({ url: `/crm/stock-product-detail/delete-list?ids=${ids.join(',')}` })
  },

  // 导出CRM 备货单记录明细 Excel
  exportStockProductDetail: async (params) => {
    return await request.download({ url: `/crm/stock-product-detail/export-excel`, params })
  },
}